﻿//--------------------------------------------------------------------------------------------------------------------------------------------------------
// <copyright file="ConfigFileConfiguration.cs">
//     Copyright © 2010 Oli Francis
//     This source code is subject to the terms and conditions of the MIT license. A copy of the license can be found in the license.txt 
//     file at the root of this distribution. By using this source code in any fashion, you are agreeing to be bound by the terms of the MIT License. 
//     You must not remove this notice from the software.
// </copyright>
// <author>Oli</author>
//-------------------------------------------------------------------------------------------------------------------------------------------------------
    
namespace TeamBrain.Domain.Services.Configuration
{
    using System;
    using System.Configuration;

    /// <summary>
    /// Exposes configuration from a config file
    /// </summary>
    public class ConfigFileConfiguration : IConfiguration
    {
        /// <summary>
        /// Gets the root URL for the service.
        /// </summary>
        public string RootUrl
        {
            get
            {
                return ConfigurationManager.AppSettings["RootUrl"];
            }
        }

        /// <summary>
        /// Gets the display name to put on system generated emails
        /// </summary>
        public string EmailFromDisplayName
        {
            get
            {
                return ConfigurationManager.AppSettings["EmailFromDisplayName"];
            }
        }

        /// <summary>
        /// Gets the email from address to put on system generated emails
        /// </summary>
        public string EmailFromAddress
        {
            get
            {
                return ConfigurationManager.AppSettings["EmailFromAddress"];
            }
        }

        /// <summary>
        /// Gets the number of sign in attempts before an account is locked
        /// </summary>
        public int SignInAttemptsBeforeLockout
        {
            get
            {
                return Int32.Parse(ConfigurationManager.AppSettings["SignInAttemptsBeforeLockout"]);
            }
        }

        /// <summary>
        /// Gets the number of minutes until a locked account will revert to normal
        /// </summary>
        public int MinutesUntilLockoutExpires
        {
            get
            {
                return Int32.Parse(ConfigurationManager.AppSettings["MinutesUntilLockoutExpires"]);
            }
        }

        /// <summary>
        /// Gets the number of hours a password reset is valid for
        /// </summary>
        public int PasswordResetValidForHours
        {
            get
            {
                return Int32.Parse(ConfigurationManager.AppSettings["PasswordResetValidForHours"]);
            }
        }
    }
}